<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    function Parent(msg){
        this.msg = msg
    }
    Parent.prototype.show = function(){
        console.log(this.msg);
    }

    function extend(Parent){
        return function(msg){
            function Child(){};
            Child.prototype = new Parent(msg);
            return new Child();
        }
    }

    // 通过继承工具extend，继承出一个新的子类
    const Child = extend( Parent );
    
    // 通过子类创建实例，可以正常传参
    const c = new Child("hello");
    c.name = "admin";
    c.init = function(){
        console.log(this.name);
    }
    
    console.log(c);

    c.init();
    c.show();



    // 函数的高级应用：柯里化
</script>
</html>